import org.newdawn.slick.tiled.TiledMap;
import org.newdawn.slick.util.pathfinding.PathFindingContext;
import org.newdawn.slick.util.pathfinding.TileBasedMap;

public class RTSMap implements TileBasedMap {
	TiledMap map;
	boolean[][] collisionmap;
	float[][] costMap;

	public RTSMap(TiledMap m) {
		map = m;
		collisionmap = new boolean[m.getWidth()][m.getHeight()];

		for (int x = 0; x < m.getWidth(); x++) {
			for (int y = 0; y < m.getHeight(); y++) {
				int property = Integer.parseInt(m.getTileProperty(
						m.getTileId(x, y, 1), "Passable", "1"));
				if (property == 1)
					collisionmap[x][y] = true;
			}

		}
	}

	@Override
	public boolean blocked(PathFindingContext pathfinder, int x, int y) {
		System.out.println(!(collisionmap[x][y]));
		return !(collisionmap[x][y]);
	}

	@Override
	public float getCost(PathFindingContext pathfinder, int x, int y) {

		return 1;
	}

	@Override
	public int getHeightInTiles() {

		return map.getHeight();
	}

	@Override
	public int getWidthInTiles() {

		return map.getWidth();
	}

	@Override
	public void pathFinderVisited(int x, int y) {

	}

}